package com.mxpio.erp.common.plan.policy;

import java.util.ArrayList;
import java.util.List;

import com.mxpio.erp.common.jpa.model.BizPlan;
import com.mxpio.erp.common.vo.OrderExcuteLineVo;

import lombok.Data;

@Data
public class PlanContext {
	
	//计划
	private BizPlan entity;
	
	//计划类型
	private Class<? extends BizPlan> planClass;
	
	//执行行
	private List<OrderExcuteLineVo> orderExcuteVos;
	
	private List<String> errors;
	
	public static PlanContext init(BizPlan plan) {
		PlanContext context = new PlanContext();
		context.setEntity(plan);
		return context;
	}
	
	public void addError(String error) {
		if(errors == null) {
			errors = new ArrayList<>();
		}
		errors.add(error);
	}

}
